﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using University.Workshop.DataAccess;
using System.Data;
using University.Workshop.Model;

namespace University.Workshop.Business
{
    public static class RentController
    {

        public static string GetRentCode()
        {
            DataTable table = RentDataAccess.GetRentCode("nothing");
            if (table.Rows.Count != 0)
                return (Convert.ToDouble(table.Rows[0].ItemArray[0].ToString(), System.Globalization.CultureInfo.CurrentCulture) + 1).ToString(System.Globalization.CultureInfo.CurrentCulture).ToString();
            else
                return "Error";
        }

        public static void RentRegister(Rent rent)
        {
            RentDataAccess.RentRegister(rent);
        }

        public static void RentDetailRegister(RentDetail rentDetail)
        {
            RentDataAccess.RentDetailRegister(rentDetail);
        }
    }
}
